#include <2025Linux.h>
void handler(int signum){
    printf("signum = %d\n", signum);
}
int main(int argc, char *argv[])
{
    signal(SIGINT,handler);
    sigset_t set,oldset;
    sigemptyset(&set);
    sigaddset(&set,SIGINT);
    sigprocmask(SIG_BLOCK,&set,&oldset);//屏蔽二号信号
    sleep(10);
    printf("sleep over!\n");
    sigset_t pendingset;
    sigpending(&pendingset);//获取当前的pending集合
    if(sigismember(&pendingset,SIGINT)){
        printf("SIGINT is pending!\n");
    }
    else{
        printf("SIGINT is not pending!\n");
    }
    sigprocmask(SIG_SETMASK,&oldset,NULL);//解除二号信号的屏蔽
    while(1){
        sleep(1);
    }
    return 0;
}

